package com.dubito.room.dao

import androidx.room.Dao
import androidx.room.Query
import com.dubito.room.entity.Dog
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged


@Dao
interface DoggosDao {


    @Query("SELECT * FROM Dog")
    fun getAllDogs(): Flow<List<Dog>>


    @Query("SELECT * FROM Dog WHERE name = :name")
    fun getDog(name: String): Flow<Dog>


    fun getDogDistinctUntilChanged(name: String) =
        getDog(name).distinctUntilChanged()
}